#pragma once

#include <queue>
#include "data_structure.h"

#include "busesp.pb.h"
#include "vcu.pb.h"
#include "lon_control.pb.h"
#include "state_machine.pb.h"
#include "sas.pb.h"
#include "hmi_basic_statefusion.pb.h"
#include "buseps.pb.h"


using namespace std;


typedef enum 
{
    e_uint32,
    e_uint64,
    e_int32,
    e_int64,
    e_double,
    e_float,
    e_bool
}E_data_type;   


typedef enum
{
    TOPIC_ID_sab_BusespProto_BusEsp = 0,
    TOPIC_ID_sab_VcuProto_Vcu,
    TOPIC_ID_control_LONProto_LongCtrlCmdOutProto,
    TOPIC_ID_state_switch_Sts_FromSTS,
    TOPIC_ID_sas_com_SasProto_AebResult,
    TOPIC_ID_sas_com_SasProto_LasSystemState,
    TOPIC_ID_hmi_interface_HmiInterface_BasicStateFusion,
    TOPIC_ID_sab_BusepsProto_BusEps,
    TOPIC_ID_pnp_pnp_PlanningOutput,
    TOPIC_ID_hmi_interface_HmiInterface_HmiParkInternal
}EnumNewTopicID;

typedef union 
{
    uint32_t data_uint32;
    uint64_t data_uint64;
    int32_t data_int32;
    int64_t data_int64;
    double data_double;
    float data_float;
    bool data_bool;
}u_Signal_data;   

typedef struct Signal_data_info_t
{
    uint8_t type;      //代表下面用的哪种类型；从0开始表示第一个
    u_Signal_data union_dataValue;
}T_Signal_data_info;

int inner_event_get_topic_id(string topic_name);
void topic_data_parse_and_save(const ProtoData &data);

void save_signal_to_map(string signalname, T_Signal_data_info data_info);
void save_signal_to_map(string signalname, uint32_t data);
void save_signal_to_map(string signalname, int32_t data);
void save_signal_to_map(string signalname, uint64_t data);
void save_signal_to_map(string signalname, int64_t data);
void save_signal_to_map(string signalname, double data);
void save_signal_to_map(string signalname, float data);
void save_signal_to_map(string signalname, bool data);

void get_signal_from_map(string signalname, T_Signal_data_info &data);
void get_signal_from_map(string signalname, uint32_t*data);
void get_signal_from_map(string signalname, int32_t *data);
void get_signal_from_map(string signalname, uint64_t *data);
void get_signal_from_map(string signalname, int64_t *data);
void get_signal_from_map(string signalname, double *data);
void get_signal_from_map(string signalname, float *data);
void get_signal_from_map(string signalname, bool *data);



#if 0
namespace DcAdr
{
    class SignalCatch
    {
    public:
        static SignalCatch &getInstance();


    private:
        SignalCatch();
        ~SignalCatch();

        static map<string, int> SignalCatch g_map_topic_id;

        // map for signal catches
        map<string, T_Signal_data_info> g_data_catch;

    };
}
#endif